home *** CD-ROM | disk | FTP | other *** search
/ Software USA 3 #11 / Software USA Volume 3.11.iso / mac / Education / MacAtoms / MacAtoms 3.2.0 / MacAtoms 3.2.0.rsrc / TEXT_2000_BW.txt < prev    next >
Text File  |  1993-05-30  |  1KB  |  81 lines

  1. %% Copyright Hilary D. Jones, 1989-1993
  2. /out {print flush} def
  3. (Setting up.\n) out
  4. /inFile (%stdin) (r) file def
  5. /getToken {inFile token pop} bind def
  6. /setXform {
  7.     getToken
  8.     72 div /z exch def
  9.     /tm matrix defaultmatrix def
  10.     0 1 3 {
  11.         dup tm exch get 100 mul z div round 100 div
  12.         tm 3 1 roll put
  13.     } for
  14.     tm setmatrix
  15. } bind def
  16. /getTypes { /numTypes getToken def } bind def
  17. /getRadii {
  18.     /radii numTypes array def
  19.     /diam numTypes array def
  20.     0 1 numTypes 1 sub { radii exch getToken put } for
  21.     0 1 numTypes 1 sub { diam exch dup radii exch get 2 mul 1 add put } for
  22. } bind def
  23. /getRow {
  24.     exch dup 3 -1 roll getToken put
  25. } bind def
  26. /getData {
  27.     dup diam exch get array
  28.     exch diam exch get 1 sub 0 exch 1 exch
  29.     {getRow } for
  30. } bind def
  31. /getPictures {
  32.     /idat numTypes array def
  33.     0 1 numTypes 1 sub {idat exch dup getData put} for
  34. } bind def
  35. /row {
  36.     idat aType get
  37.     nrow get
  38.     /nrow nrow 1 add def
  39. } bind def
  40. /border {
  41.     newpath
  42.     radii exch get dup dup 0 360 arc
  43.     closepath
  44. } bind def
  45. /pim {
  46.     gsave
  47.     translate
  48.     /aType exch def
  49.     aType border clip
  50.     /nrow 0 def
  51.     diam aType get dup 1
  52.     matrix
  53.     { row }
  54.     image
  55.     grestore
  56. } bind def
  57. /plotOne {
  58.     getToken
  59.     dup radii exch get dup
  60.     getToken exch sub
  61.     exch getToken exch sub
  62.     pim
  63. } bind def
  64. /plotAtoms {
  65.     1 1 getToken {pop plotOne} for
  66. } bind def
  67. /doit {
  68.     gsave
  69.     setXform
  70.     getTypes
  71.     getRadii
  72.     (Transferring image data.\n) out
  73.     getPictures
  74.     (Rendering images\n) out
  75.     plotAtoms
  76.     grestore
  77.     flush
  78. } bind def
  79. (Setup complete\n) out
  80. doit
  81.